﻿#pragma once

// HtaHelperXCtrl.h : CHtaHelperXCtrl ActiveX 控件类的声明。


// CHtaHelperXCtrl : 请参阅 HtaHelperXCtrl.cpp 了解实现。

class CHtaHelperXCtrl : public COleControl
{
	DECLARE_DYNCREATE(CHtaHelperXCtrl)

// 构造函数
public:
	CHtaHelperXCtrl();

// 重写
public:
	virtual void OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid);
	virtual void DoPropExchange(CPropExchange* pPX);
	virtual void OnResetState();

// 实现
protected:
	~CHtaHelperXCtrl();

	HWND main_hwnd = 0; // 主框架句柄

	DECLARE_OLECREATE_EX(CHtaHelperXCtrl)    // 类工厂和 guid
	DECLARE_OLETYPELIB(CHtaHelperXCtrl)      // GetTypeInfo
	DECLARE_PROPPAGEIDS(CHtaHelperXCtrl)     // 属性页 ID
	DECLARE_OLECTLTYPE(CHtaHelperXCtrl)		// 类型名称和杂项状态

// 消息映射
	DECLARE_MESSAGE_MAP()

// 调度映射
	DECLARE_DISPATCH_MAP()

	afx_msg void AboutBox();

// 事件映射
	DECLARE_EVENT_MAP()

// 调度和事件 ID
public:
	enum {
		dispidSwitchW = 11L,
		dispidGetMainID = 10L,
		dispidMoveW = 9L,
		dispidShow = 8L,
		dispidFind = 7L,
		dispidExec = 6L,
		dispidMove = 5L,
		dispidExit = 4L,
		dispidRestore = 3L,
		dispidMin = 2L,
		dispidMax = 1L
	};
protected:
	void Max();
	void Min();
	void Restore();
	void Exit();
	void Move();
	void Exec(BSTR oper, BSTR path, BSTR params, BSTR dir, USHORT show);
	LONG Find(BSTR title);
	LONG Show(BSTR text, BSTR title, LONG type);
	void MoveW(LONG hwnd, LONG x, LONG y, LONG width, LONG height, LONG refresh);
	LONG GetMainID();
	void SwitchW(LONG hwnd);
};

